// 导入图标
import {
  IconClockCircle,
  IconPlayCircle,
  IconPauseCircle,
  IconExclamationCircle,
  IconCheckCircle,
  IconClose,
  IconSettings
} from '@arco-design/web-vue/es/icon'

// 里程碑/任务状态配置
export const COMPLETE_STATUS_CONFIG = {
  NOT_STARTED: {
    value: 0,
    label: '未开始',
    color: '#FF9900',
    icon: IconClockCircle    // 时钟图标
  },
  IN_PROGRESS: {
    value: 1,
    label: '进行中',
    color: '#2080F0',
    icon: IconPlayCircle     // 播放图标
  },
  PAUSED: {
    value: 2,
    label: '暂停中',
    color: '#FFCC00',
    icon: IconPauseCircle    // 暂停图标
  },
  OVERDUE: {
    value: 3,
    label: '已逾期',
    color: '#F53F3F',
    icon: IconExclamationCircle  // 感叹号图标
  },
  COMPLETED: {
    value: 4,
    label: '已完成',
    color: '#00B42A',
    icon: IconCheckCircle     // 对勾图标
  },
  ABANDONED: {
    value: 5,
    label: '已废弃',
    color: '#86909C',
    icon: IconClose          // 修改为关闭图标
  }
} as const

// 缺陷状态配置
export const BUG_STATUS_CONFIG = {
  PENDING: {
    value: 0,
    label: '待解决',
    color: '#FF9900',
    icon: IconExclamationCircle  // 感叹号图标
  },
  RESOLVED: {
    value: 1,
    label: '已解决',
    color: '#2080F0',
    icon: IconCheckCircle     // 对勾图标
  },
  FIXED: {
    value: 4,
    label: '已修复',
    color: '#00B42A',
    icon: IconCheckCircle     // 对勾图标
  },
  MANAGED: {
    value: 5,
    label: '已关闭',
    color: '#86909C',
    icon: IconSettings   // 改为 IconSettings
  }
} as const

// 导出状态值类型
export type CompleteStatus = typeof COMPLETE_STATUS_CONFIG[keyof typeof COMPLETE_STATUS_CONFIG]['value'] 


// 修改获取状态文本的函数
export const getCompleteStatus = (status: any) => {
  const statusConfig = Object.values(COMPLETE_STATUS_CONFIG).find(config => config.value === status)
  return statusConfig?.label || '未知'
}

// 修改获取状态颜色的函数
export const getCompleteColor = (status: any) => {
  const statusConfig = Object.values(COMPLETE_STATUS_CONFIG).find(config => config.value === status)
  return statusConfig?.color || 'gray'
}

// 新增获取状态图标的函数
export const getCompleteIcon = (status: any) => {
  const statusConfig = Object.values(COMPLETE_STATUS_CONFIG).find(config => config.value === status)
  return statusConfig?.icon || IconClockCircle
}

